<?php
class Admin_Form_AddCustomer extends Apps_Form {
    public function init() {
        $dMapper = new M_Tool_DataMapper();

    // Customer
        $fullName = new Zend_Form_Element_Text(
        					      'full_name',
                                  array(
                                      'label' 		=> 'Full name',
        							  'required' 	=> true,
			                          'class' 		=> 'hint',
                                      'filters' 	=> array('StringTrim'),
                                	  'title' 		=> 'Họ và tên khách hàng',
									  'validators'	=>	array(new Zend_Validate_Db_NoRecordExists(
															array(
																	'table'	=>	'customer',
																	'field'	=>	'full_name'
															)))
                                  )
                              );
        $email = new Zend_Form_Element_Text(
        					      'email',
                                  array(
                                      'label' 	=> 'Email',
        							  'required' => true,
			                          'class' 	=> 'hint',
                                      'filters' => array('StringTrim'),
                                	  'title' 	=> 'Email',
									  'validators'	=>	array(new Zend_Validate_Db_NoRecordExists(
															array(
																	'table'	=>	'customer',
																	'field'	=>	'email'
															)))
                                  )
                              );
        $phone = new Zend_Form_Element_Text(
        					      'phone',
                                  array(
                                      'label' 	=> 'Phone',
			                          'class' 	=> 'hint',
                                      'filters' => array('StringTrim'),
                                	  'title' 	=> 'Điện thoại'
                                  )
                              );
        $address = new Zend_Form_Element_Text(
        					      'address',
                                  array(
                                      'label' 	=> 'Address',
			                          'class' 	=> 'hint',
                                      'filters' => array('StringTrim'),
                                	  'title' 	=> 'Địa chỉ'
                                  )
                              );
        $country = new Zend_Form_Element_Text(
        					      'country_residence',
                                  array(
                                      'label' 	=> 'Country',
			                          'class' 	=> 'hint',
                                      'filters' => array('StringTrim'),
                                	  'title' 	=> 'Quốc gia'
                                  )
                              );

        $description = new Zend_Form_Element_Textarea(
        						       'description',
                                        array(
                                        	'label'   => 'Description',
                                            'filters' => array('StringTrim')
                                        )
                                    );

// Form
		$this->addElement($fullName)
		     ->addElement($email)
			 ->addElement($phone)
			 ->addElement($address)
			 ->addElement($country)
			 ->addElement($description);

		$this->setLegend('Add New Customer');
		$this->addActionGroup()
			 ->makeup();
    }
}